<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
  
<!-- Mirrored from bos.asmhackers.net/docs/filesystems/ntfs/dir.html by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 07 Oct 2014 11:26:07 GMT -->
<head>
    <title>NTFS Documentation: Directory</title>
  </head>

  <body>
      <h1><a href="index-2.html#NTFS" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/index.html#NTFS">NTFS</a> Documentation: Directory</h1>

      <h2>Definition</h2>
      From an human person's point of view, a directory is a particular kind of <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a> that can contain other <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a>s. It is a <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a> <a name="folder">folder</a>, used in a nested way to create a logical <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a> hierarchy on a <a href="glossary.html#Volume" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Volume">volume</a>.
      <p>

      <h2>Properties</h2>
      From <a href="index-2.html#NTFS" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/index.html#NTFS">NTFS</a>' point of view, a directory is an index of <a href="filename.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/filename.html">file name</a>s, or more accurately a sequence of <a href="indexentry.html#contain" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html#contain">index entries containing a filename attribute</a>. An <a href="indexentry.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html">index entry</a> is created for each <a href="filename.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/filename.html">file name attribute</a> of each <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a> contained in the <a href="#folder">folder</a>. This kind of <a href="indexentry.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html">index entries</a> can be compared together using the lexicographical order on their uppercased (thanks to <a href="upcase.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/upcase.html">$UpCase</a>) <a href="filename.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/filename.html">file name attribute</a>.
      <p>

      A directory has no <a href="data.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/data.html">data attribute</a>. But, as an index, it has instead three other <a href="attribute.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/attribute.html">file attribute</a>s: <a href="indexroot.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexroot.html">index root</a>, <a href="indexallocation.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexallocation.html">index allocation</a>, and <a href="bitmap2.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/bitmap2.html">bitmap</a>. The index is stored in the <a name="node">node</a>s of a <a name="btree">B+ tree</a> in the following manner:
      <ul>
        <li>Each node of the tree contains one or several <a href="indexentry.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html">index entries</a>. Within a node, <a href="indexentry.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html">index entries</a> are sorted in increasing order
        <li>Each <a href="indexentry.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html">index entry</a> may point to another (sub-)node containing only lower <a href="indexentry.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html">index entries</a>
        <li>The <a name="rnode">root node</a> is in the <a href="indexroot.html#layout" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexroot.html#layout">stream of the index root attribute</a>, the other <a name="ibnode">(sub-)node</a>s are <a href="INDX.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/INDX.html">index buffer</a>s.
      </ul>
      <p>

      <h2>Interest</h2>

      When an application reads a directory, <a href="index-2.html#NTFS" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/index.html#NTFS">NTFS</a> returns a list of <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a> names which is already sorted.
      <p>

      The B+ tree structure (which is used in <a href="glossary.html#HPFS" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#HPFS">HPFS</a> too), when built in a balanced way, is far more efficient than a linear structure to perform a <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a> name lookup in a <a href="#folder">folder</a> containing a large number of <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a>s.
      <p>

      Although the <a href="indexentry.html#copy" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html#copy">duplication of the stream of the indexed attribute</a> in an <a href="indexentry.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexentry.html">index entry</a> can cost some time, it is worthy because you can browse an index without actually opening all the indexed <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a>s (FAT and <a href="glossary.html#HPFS" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#HPFS">HPFS</a> do that, too).
      <p>

      In a directory, the three <a href="attribute.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/attribute.html">file attribute</a>s: <a href="indexroot.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexroot.html">index root</a>, <a href="indexallocation.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/indexallocation.html">index allocation</a>, and <a href="bitmap2.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/bitmap2.html">bitmap</a> are named &quot;$I30&quot;, and a directory is just an Index of <a href="attribute.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/attribute.html">file attribute</a>s whose <a href="attribute.html#type" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/attribute.html#type">type</a> is 30. But <a href="index-2.html#NTFS" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/index.html#NTFS">NTFS</a> has been thought as a database <a href="glossary.html#Filesystem" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#Filesystem">filesystem</a>, and it can actually create indexes based on any <a href="attribute.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/attribute.html">file attribute</a> that is <a href="AttrDef.html#f80_field" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/AttrDef.html#f80_field">always resident</a>. E.g., you could create a new <a href="attribute.html" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/attribute.html">file attribute</a> labeled &quot;author name&quot;, and sort your <a href="glossary.html#File" tppabs="http://www.via.ecp.fr/~regis/ntfs/new/glossary.html#File">file</a>s according to that criteria.
      <p>

      <hr>
      <address><a href="mailto:regis@via.ecp.fr">Regis Duchesne</a> at <a href="javascript:if(confirm('http://www.via.ecp.fr/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.via.ecp.fr/'" tppabs="http://www.via.ecp.fr/">VIA</a>, <a href="javascript:if(confirm('http://www.ecp.fr/  \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?'))window.location='http://www.ecp.fr/'" tppabs="http://www.ecp.fr/">ECP</a>, France</address>
<!-- Created: Wed Apr  9 11:24:53 CEST 1997 -->
<!-- hhmts start -->
Last modified: Sun Feb 14 15:11:45 PST 1999
<!-- hhmts end -->
  </body>

<!-- Mirrored from bos.asmhackers.net/docs/filesystems/ntfs/dir.html by HTTrack Website Copier/3.x [XR&CO'2013], Tue, 07 Oct 2014 11:26:07 GMT -->
</html>
